<div style="padding-left:10px">
<h1>New user</h1>
<% form_for(@user) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :name, 'Last Name' %><br />
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :firstName, 'First Name' %><br />
    <%= f.text_field :firstName %>
  </p>
	<p>
    <%= f.label :email, 'Email' %><br />
    <%= f.text_field :email, :value => "" %>
  </p>
	<% if (@loggedin_user && !@loggedin_user.isAdmin? )|| @loggedin_user.nil? %> 
		<p>
		<%# creates a label object for the Order's name attribute, and what text you want to display %>
		<%# a dropdown select box, where the entries are those we specify in the Order.rb as Payment types %>
		<%= f.select :user_role, User::USER_ROLES[0, 1] %>
	</p>	
	<%else%>
	<p>
		<%# creates a label object for the Order's name attribute, and what text you want to display %>
		<%= f.label :user_role, "User's role:" %>
		<%# a dropdown select box, where the entries are those we specify in the Order.rb as Payment types %>
		<%= f.select :user_role, User::USER_ROLES, :prompt => "Choose a role..." %>
	</p>
	<% end %>

	
  <p>
    <%= f.label :user_password, 'Password' %><br />
    <%= f.password_field :password %>
  </p>
	<p>
		<%= f.label :confirm_password, "Confirm Password" %><br />
		<%= f.password_field :password_confirmation %>
	</p>
  <p>
    <%= f.label :nickName, "Desired Nickname"%><br />
    <%= f.text_field :nickName %>
  </p>
<%# NESTED FORM.  In one form I can fill out the fields for 2 different data objects.  See users_controller.rb(28) and (39) %>
	<% f.fields_for :address, @user.address do |address| %>

	    <p>
		    <%= address.label :street %><br />
		    <%= address.text_field :street %>
		  </p>
		  <p>
		    <%= address.label :streetNr %><br />
		    <%= address.text_field :streetNr %>
		  </p>
		  <p>
		    <%= address.label :city %><br />
		    <%= address.text_field :city %>
		  </p>
		  <p>
		    <%= address.label :zip %><br />
		    <%= address.text_field :zip %>
		  </p>

	<% end %>
  <p>
    <%= f.submit 'Create' %>
  </p>
<% end %>

<% if (@user.isAdmin?) %>
	<%= link_to 'Back', users_path %>
<% end %>
</div>